﻿using DTTB.Assembler;
using DTTB.DAO;
using DTTB.Domain;
using DTTB.DTO;
using DTTB.SERVICE.Base;

namespace DTTB.SERVICE
{
    public class DepartmentsService : BaseService<DepartmentsDto, Departments>
    {
        readonly DepartmentsAssembler DepartmentsAssembler = new DepartmentsAssembler();
        readonly DepartmentsDao DepartmentsDao = new DepartmentsDao();

        //public DepartmentsDao DepartmentsDao
        //{
        //    get
        //    {
        //        return (DepartmentsDao)this.BaseDao;
        //    }
        //}


        //public IList<DepartmentsDto> GetAllDepartments()
        //{
        //    IList<Departments> jobTitlesList = DepartmentsDao.GetAllDepartments();

        //    IList<DepartmentsDto> jobTitlesDtoList = DepartmentsAssembler.ConvertToDataTransferObjectList(jobTitlesList);

        //    return jobTitlesDtoList;
        //}

        public DepartmentsDto GetDepartmentsById(string jobTitlesId)
        {
            Departments jobTitles = DepartmentsDao.GetDepartmentsById(jobTitlesId);

            DepartmentsDto jobTitlesDto = DepartmentsAssembler.ConvertToDataTransferObject(jobTitles);

            return jobTitlesDto;
        }

        public bool AddNewDepartments(DepartmentsDto jobTitlesDto)
        {
            return this.DepartmentsDao.AddNewDepartments(this.DepartmentsAssembler.ConvertToBusinessObject(jobTitlesDto));
        }

        public bool AddNewDepartments(DepartmentsDto jobTitlesDto, ref int idReturn)
        {
            return this.DepartmentsDao.AddNewDepartments(this.DepartmentsAssembler.ConvertToBusinessObject(jobTitlesDto), ref idReturn);
            //return this.DepartmentsDao.AddNewDepartments(this.Assembler.ConvertToBusinessObject(jobTitlesDto), ref idReturn);
        }


        public bool ShiftDelete(string jobTitlesId)
        {
            return this.DepartmentsDao.ShiftDelete(jobTitlesId);
        }

        public bool Delete(string jobTitlesId)
        {
            return this.DepartmentsDao.Delete(jobTitlesId);
        }

        public bool Update(DepartmentsDto jobTitlesDto)
        {
            return this.DepartmentsDao.Update(this.DepartmentsAssembler.ConvertToBusinessObject(jobTitlesDto));
        }

        public DepartmentsDto GetDepartmentByName(string jobTitleName)
        {
            return this.DepartmentsAssembler.ConvertToDataTransferObject(this.DepartmentsDao.GetDepartmentByName(jobTitleName));
        }

        public DepartmentsDto GetDepartmentsByName(string jobTitleName)
        {
            return this.DepartmentsAssembler.ConvertToDataTransferObject(this.DepartmentsDao.GetDepartmentByName(jobTitleName));
        }
    }
}
